<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>绝对定位</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        li {
            list-style: none;
        }

        a {
            color: #333;
            text-decoration: none;
        }

        img {
            width: 400px;
        }

        .news {
            position: relative;
            margin: 100px auto;
            width: 400px;
            height: 350px;
            background-color: #f8f8f8;
        }

        /* 
            绝对定位特点(子绝父相)
            1.脱离文档流,不占位
            2.参照物:找最近已经定位的元素,如果都没有定位,则是浏览器
            3.显示模式会改变成行内快元素的特点
        */
        .news span {
            position: absolute;
            top: 0;
            right: 0;

            width: 92px;
            height: 32px;
            background-color: rgba(0, 0, 0, 0.6);
            text-align: center;
            line-height: 32px;
            color: #fff;
        }
    </style>
</head>

<body>
    <div class="news">
        <img src="../day07/img/news.jpg" alt="">
        <span>活动</span>
        <h4>22222世界大会</h4>
    </div>
</body>

</html>